﻿using Ledict.Core.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ledict.ConditionExtract.DAL
{
   public class Sys_CourtDAL
    {
        private string DbName;
        public Sys_CourtDAL()
        {
            DbName = "JudgeDoc";
        }

        /// <summary>
        /// 获取法院信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetSysCourtData()
        {
            string sql = " select CH_Name as Name,CourtID as ID,CH_ParentID as ParentID from dbo.SYS_Court ";           
            Database oBase = DatabaseFactory.CreateDatabase(DbName);
            DbCommand oCmd = oBase.GetSqlStringCommand(sql);
            DataTable OtB = oBase.ExecuteDataSet(oCmd).Tables[0];
            if (OtB != null && OtB.Rows.Count > 0)
            {
                return OtB;
            }
            else
            {
                return new DataTable();
            }            
        }
    }
}
